using UnityEngine;

public class CourtStateJumpBall : AbstractCourtState
{
	private static CourtStateJumpBall instance;

	private CourtStateJumpBall()
	{
	}

	public static CourtStateJumpBall getInstance()
	{
		if (instance == null)
		{
			instance = new CourtStateJumpBall();
		}
		return instance;
	}

	public override void enter(Court owner)
	{
		base.enter(owner);
		Instance<UIGame>.instance.show_countdown();
		Instance<CameraController>.instance.stopAnimation();
		Instance<CameraController>.instance.setPositon(Vector3.zero);
		Instance<CameraController>.instance.cameraMain.fieldOfView = Global.cameraFieldOfView;
		Color color = owner.textureTeamComLogo.color;
		if (color.r == 1f)
		{
			owner.setAnimation(owner.textureTeamUserLogo, 0f, isUser: true);
			owner.setAnimation(owner.textureTeamComLogo, 0f, isUser: false);
		}
		for (int i = 0; i < 5; i++)
		{
			owner.teamUser.getPlayer(i).setPositon(Global.posJumpBall_Left[i]);
			if (owner.teamUser.getPlayer(i).playerType != PlayerType.CENTER)
			{
				owner.teamUser.getPlayer(i).LookAt(Vector3.zero);
			}
			else
			{
				owner.teamUser.getPlayer(i).LookAt(MathHelper.setY(Instance<CameraController>.instance.getCameraPos(), 0f));
			}
		}
		for (int j = 0; j < 5; j++)
		{
			owner.teamComputer.getPlayer(j).setPositon(Global.posJumpBall_Right[j]);
			if (owner.teamComputer.getPlayer(j).playerType != PlayerType.CENTER)
			{
				owner.teamComputer.getPlayer(j).LookAt(Vector3.zero);
			}
			else
			{
				owner.teamComputer.getPlayer(j).LookAt(MathHelper.setY(Instance<CameraController>.instance.getCameraPos(), 0f));
			}
		}
	}
}
